<%@page import="java.util.ArrayList"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ page import="connection.UsersDAO"%>
<%
	String username = "";
	String password = "";
	request.setCharacterEncoding("utf-8");

	username = request.getParameter("username");
	password = request.getParameter("password");
	
	UsersDAO userdao=new UsersDAO();
	if(username.length()==0){
		response.sendRedirect("zhuce_fail2.jsp");
	}
	else if(password.length()==0||password.length()>10){
		response.sendRedirect("zhuce_fail.jsp");
	}
	else if(userdao.getUser(username)==null){
		if(userdao.setNewuser(username, password)==0){
			response.sendRedirect("zhuce_fail.jsp");
		}else{
			request.getRequestDispatcher("display.jsp").forward(request,
					response);
		}	
	}else{
		response.sendRedirect("zhuce_fail1.jsp");
	}
%>